<!DOCTYPE html>
<html class="x-admin-sm">
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.1</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <style>
        .layui-form-item .layui-form-label{
            width: 120px;
        }
        .layui-form-item .layui-textarea{
            width: 190px;
        }
    </style>
  </head>
  
  <body>
    <div class="x-body">
        {if condition="!$errorArr && !$successArr"}
        <form class="layui-form"  method="post" enctype="multipart/form-data">
          <div class="layui-form-item">
              <label for="name" class="layui-form-label">
                  Excel文件<br>首行不要放数据<br><a target="_blank" class="layui-font-blue" href="/uploads/example/clients.xlsx">格式文件例子</a>
              </label>
              <div class="layui-input-inline">
                  <input type="file" id="file" name="file" required="" lay-verify="required" accept="application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" autocomplete="off" class="layui-input">
              </div>
          </div>

          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button type="submit" class="layui-btn" lay-filter="add" lay-submit="">
                  上传
              </button>
          </div>
      </form>
      {else /}
      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>成功导入{:count($successArr)}条,失败(重复){:count($errorArr)}条. 请检查与备份失败记录。<font color"red">请返回列表刷新</font></legend>
      </fieldset>
      <div class="layui-table-body layui-table-main" style="width: 100%;">
      <table class="layui-table layui-form">
        <thead>
          <tr>
            <th>赛事名称</th>
            <th>比赛时间</th>
            <th>地区(市、县)</th>
            <th>客户姓名</th>
            <th>手机</th>
            <th>微信</th>
          </tr>
        </thead>
        <tbody>
          {volist name="errorArr" id="v"}
          <tr>
            <td>{$v.activity}</td>
            <td>{$v.address}</td>
            <td>{$v.activity_time}</td>
            <td>{$v.name}</td>
            <td>{$v.phone}</td>
            <td>{$v.wx}</td>
          </tr>
          {/volist}
        </tbody>
      </table>
    </div>
      {/if}
      

    </div>
    <script>
        layui.use(['form','layer','laydate','upload'], function(){
          $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer
          ,laydate = layui.laydate
          ,upload = layui.upload;


          //自定义验证规则
          form.verify({
            activity: function(value){
              if(value.length < 2){
                return '活动名称至少2个字';
              }
            }
          });

          //监听提交
         /* form.on('submit(add)', function(data){

            
            $.ajax({
                type:'POST',
                dataType:'json',
                data:{data:data.field},
                url:"{:url('Client/add')}",
                success:function(obj){
                  layer.alert(obj.msg, {icon: obj.icon},function(){
                    // 获得frame索引
                    var index = parent.layer.getFrameIndex(window.name);
                    //关闭当前frame
                    parent.layer.close(index);
                    // 可以对父窗口进行刷新 
                    x_admin_father_reload();
                  });
                }
            });
            return false;
          });*/
          
          
        });
    </script>
  </body>

</html>